home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5444 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.2 KB

  1. Path: mail2news.demon.co.uk!hpl3sn03.cern.ch
  2. From: Dan Pop <danpop@mail.cern.ch>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Limit on #bytes inside of struct?
  5. Date: Mon, 12 Feb 1996 13:17:47 +0100
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <9602121217.AA07160@dxmint.cern.ch>
  8. References: <4feg1d$d4g@cville-srv.wam.umd.edu> <4ffg6b$ivd@sparcserver.lrz-muenchen.de> <4ffohq$1gb@mordred.gatech.edu> <4ffun7$1l4l@cymbal.aix.calpoly.edu> <311F15D8.78D1@zess.uni-siegen.de>
  9. X-NNTP-Posting-Host: hpl3sn03.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11. X-Mail2News-Path: dxmint.cern.ch!hpl3sn03.cern.ch
  12.  
  13. Markus Becker <becker@zess.uni-siegen.de> writes:
  14.  
  15. >No it isn't, see below.
  16. >
  17. >>    typedef struct {
  18. >>       int the_array[50000];
  19. >>    } struct_type;
  20. >> 
  21. >
  22. >This way, you don't put the 50K numbers in the struct, but only
  23. >a pointer to them. Should be at most 4 bytes.
  24.  
  25. Why do clueless people insist on posting their answers and corrections,
  26. making fools of themselves in front of the whole world is beyond me.
  27.  
  28. Please take these two mandatory steps before posting your answers and
  29. objections to other people's answers to c.l.c:
  30.  
  31. 1. Learn C.  A _good_ book will help a lot.
  32.  
  33. 2. Read the FAQ.
  34.  
  35. These two steps will help saving our time and your face.
  36.  
  37. For the technical part of the article:
  38.  
  39. o I'm typing this on a system where pointers are 8 bytes and I do know
  40.   a system which has 16-byte pointers (and is in current use today).
  41.  
  42. o Try printing the value of sizeof(struct_type).  The most likely
  43.   results are 100000 and 200000 (that is, if you use the correct
  44.   conversion specification in the printf format and if your compiler
  45.   supports objects of this size :-)
  46.  
  47. o As steps #1 and #2 mentioned above will show you, an array decays into
  48.   a pointer only when used in a value context.  And, of course, pointers
  49.   and arrays are _not_ equivalent and cannot be used interchangeably.
  50.  
  51. >--
  52. >Markus Becker                
  53. >http://www.zess.uni-siegen.de/private/becker/win95
  54.                                               ^^^^^
  55.                      Could this explain the confusion of the poster? :-)
  56.  
  57. Dan
  58. -- 
  59. Dan Pop
  60. CERN, CN Division
  61. Email: danpop@mail.cern.ch 
  62. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  63.